import java.awt.Dimension;

import javax.swing.JLabel;
import javax.swing.JTextPane;
import javax.swing.JPanel;

import javax.swing.*;
import javax.swing.text.*;

public class HelpPanel extends JPanel{
	
	public HelpPanel(){
		 JPanel hPanel = new JPanel();
	     hPanel.setPreferredSize(new Dimension(1000, 500));
         
         add(hPanel);
         
         
         // Create the StyleContext, the document and the pane
         StyleContext sc = new StyleContext();
         final DefaultStyledDocument doc = new DefaultStyledDocument(sc);
         JTextPane pane = new JTextPane(doc);

         // Create and add the style
         final Style heading2Style = sc.addStyle("Heading2", null);
         heading2Style.addAttribute(StyleConstants.FontSize, new Integer(16));
         heading2Style.addAttribute(StyleConstants.FontFamily, "serif");
         heading2Style.addAttribute(StyleConstants.Bold, new Boolean(true));

         try {
           SwingUtilities.invokeAndWait(new Runnable() {
             public void run() {
               try {
                 // Add the elements to the document
                 doc.insertString(0, helpText, null);
               } catch (BadLocationException e) {
               }
             }
           });
         } catch (Exception e) {
           System.out.println("Exception when constructing document: " + e);
           System.exit(1);
         }

         pane.setSize(1000, 500);
         hPanel.add(new JScrollPane(pane));
         //setVisible(true);
       }

       public static final String helpText = 
    	   "Operation:\n\n"
    	    + "1) Fill in the following Parameters:\n\n"
    	   	+ "a)Number of Splits:"
           	+ "This determines the threshold levels to be used for simulation.\n"
       		+ "b)Truncation Bias:"
       		+ "Number of levels in threshold drop after which the sample can be considered a miss.\n"
  			+ "c)Number of Threshold Hits/Split:"
  			+ "This determines how many threshold hits are required to be hit before simulation moves on to next level.\n"
  			+ "\n\n"
  			+ "2)Result Graph:"
  			+ "This panel displays the graph of the all the runs\n"
  			+ "\n"
  			+ "3)Result Data:"
  			+ "This panel shows the result of the simulation\n"
  			+ "\n\nIntegration:\n\n"
       		+ "1) Create or modify the SplitSimSystem class as the system itself or an extension to the system to be simulated\n"
       		+ "2) Make sure that SplitSimSystem extends the SplitSystemConcrete and implements SplitSimAbstract for proper integration\n"
       		+ "\n\nOpen Source Code repository:\n\n"
       		+ "1) Visit http://SplitSim.googlecode.com to view project details.\n"
       		+ "2) Click on the source tab for the code checkout URL\n"
       		+ "3) Submit any issues encountered by clicking on the issues tab\n"
       		+ "4) Contact Project Owner for permission to modify the original code set";
       		
	

}
